<template>
  <div class="admin-container">
    <el-card class="admin-box animated">
      <h2 class="title">系统管理</h2>
      <el-form :model="managementForm" label-position="top" class="admin-form">
        <el-form-item label="选择管理的项目">
          <el-select v-model="managementForm.choice" placeholder="请选择管理模块" class="select-box">
            <el-option label="用户管理" value="user" />
            <el-option label="用户收藏管理" value="footprints" />
            <el-option label="房价数据管理" value="properties" />
          </el-select>
        </el-form-item>
        <el-button type="primary" @click="handleSwitch" :disabled="!managementForm.choice" class="submit-button">
          进入管理
        </el-button>
      </el-form>
    </el-card>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'

const router = useRouter()

const managementForm = ref({
  choice: ''
})

const handleSwitch = async () => {
  const choice = '/admin/' + managementForm.value.choice
  await router.push(choice)
}
</script>

<style scoped>
@keyframes slideUpFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.admin-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 60px); /* Account for header */
  padding: 20px;
  background-image: url('/login_background.jpg'); /* Same as Login.vue */
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.admin-box {
  width: 100%;
  max-width: 500px;
  padding: 30px;
  background: rgba(255, 255, 255, 0.7); /* Frosted glass effect */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.admin-box:hover {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  transform: translateY(-5px);
}

.admin-box.animated {
  animation: slideUpFadeIn 0.7s ease-out forwards;
}

.title {
  text-align: center;
  font-size: 26px;
  font-weight: 600;
  color: #303133;
  margin-bottom: 30px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.05);
}

.admin-form {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.select-box {
  width: 100%;
  max-width: 300px;
}

:deep(.el-input__wrapper) {
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  background-color: rgba(255, 255, 255, 0.8);
}

:deep(.el-input__wrapper.is-focus) {
  background-color: #fff;
  box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.3);
}

.submit-button {
  width: 100%;
  max-width: 300px;
  border-radius: 8px;
  padding: 12px;
  font-size: 16px;
  transition: all 0.3s ease;
}

.submit-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
  .admin-box {
    padding: 20px;
    max-width: 90%;
  }

  .title {
    font-size: 22px;
  }

  .submit-button {
    font-size: 14px;
    padding: 10px;
  }
}
</style>
